﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SetupLauncher.Domain.Exceptions
{
    public class ValidationException : Exception
    {
        public List<Validation> Validations { get; private set; }

        public void AddValidation(Validation validation)
        {
            SetValidations(validation);
        }

        public int CountValidations
        {
            get
            {
                if (this.Validations == null)
                    return 0;

                return this.Validations.Count;
            }
        }


        public ValidationException() { }

        public ValidationException(Validation validation) 
        {
            SetValidations(validation);
        }

        public ValidationException(List<Validation> validations)
        {
            SetValidations(validations);
        }

        private void SetValidations(List<Validation> validations)
        {
            if (this.Validations == null)
                this.Validations = new List<Validation>();

            this.Validations.AddRange(validations);
        }

        private void SetValidations(Validation validation)
        {
            if (this.Validations == null)
                this.Validations = new List<Validation>();

            this.Validations.Add(validation);
        }
    }
}
